package com.example.glgk.controller.gather;

import com.example.glgk.dto.EscalationData;
import com.example.glgk.dto.QueryEscalation;
import com.example.glgk.service.gather.DataGatherService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * @author lxk
 */
@Api(tags = "指标汇总查询接口")
@Slf4j
@RestController
@CrossOrigin(origins = "*")
@RequestMapping("/DataGatherController")
public class DataGatherController {

    @Autowired
    DataGatherService dataGatherService;

    @ApiOperation(value = "指标汇总查询")
    @PostMapping("/queryDataGather")
    public List<EscalationData> queryDataGather(@RequestBody QueryEscalation queryEscalation){
        return dataGatherService.queryDataGather(queryEscalation);
    }

    @ApiOperation(value = "指标汇总查询导出Excel")
    @PostMapping("/export")
    public void export(@RequestBody QueryEscalation queryEscalation, HttpServletResponse response){
        dataGatherService.export(queryEscalation,response);
    }
}
